package checkStraightLine;

class Solution {
    public boolean checkStraightLine(int[][] coordinates) {
        if(coordinates.length<=2){
            return true;
        }
        int x1=coordinates[0][0];
        int y1=coordinates[0][1];
        int x2=coordinates[1][0];
        int y2=coordinates[1][1];
        int[] r1={x2-x1,y2-y1};
        for (int i = 2; i <coordinates.length ; i++) {
            int xi = coordinates[i][0];
            int yi = coordinates[i][1];
            int x = xi - x1;
            int y = yi - y1;
            if (r1[0] * y != r1[1] * x) {
                return false;
            }
        }
        return true;
    }
}
